export default {
	name: "member",
	components: {
		tab: () => import("@/component/tab/index.vue"),
		cityCascader: () => import("@/component/cityCascader/index.vue"),
		resumeDetail: () => import("@/component/resumeDetail/index.vue"),
		comSearch: () => import("@/component/common/comSearch.vue"),
		comTable: () => import("@/household/common/comTable.vue"),
		payrollDetails: () => import("@/component/pages/payrollDetails.vue"),
		payrollImportDialog: () => import("@/component/pages/payrollImportDialog.vue"),
		comNavTabs: () => import("@/household/common/comNavTabs.vue"),
	},
	data() {
		return {
			pushtitle:'新消息推送',
			navList: {
				index: 0, //当前是在哪个tab栏
				data: [
					{title:'内部推送'},
					{title:'短信推送'},
				]
			},
			countPeopleByJobseeker:'所有求职者',
			countPeopleByHr:'所有hr',
			countPeopleByAll:'所有用户',
			btndisabled: false,
			status: 1,
			statusname: '',
			tableData: {},
			centerDialogVisible: false,
			a: 1,
			searchData_copy: {},
			type: 0,
			options: [],
			btnAuthority: {},
			title: "会员列表",
			functionOption: [], //职能列表
			selectFunctions: [], //职能
			functionProps: {
				value: 'code',
				label: 'name',
				children: 'subLevelModelList'
			},
			form: {
				type: "0", // 0-> 会员列表, 1-> 黑名单
				pagenum: 1,
				pagesize: 10,
				nickname: "",
				province: "",
				city: "",
				area: "",
				education: "",
				minage: "",
				maxage: "",
				sex: "",
				citys: [],
				tdaccount: "", //用户编号
				username: "", //实名用户
				cardnum: "", //证件号码
				jobstatus: "", //求职状态
				telnum: "", //手机号码
				tradeid: '', //职能
			},
			level: "0",
			edulist: [{
					value: 1,
					label: "初中"
				},
				{
					value: 2,
					label: "高中"
				},
				{
					value: 3,
					label: "中技"
				},
				{
					value: 4,
					label: "中专"
				},
				{
					value: 6,
					label: "本科"
				},
				{
					value: 7,
					label: "硕士"
				},
				{
					value: 8,
					label: "MBA"
				},
				{
					value: 9,
					label: "博士"
				},
				{
					value: 10,
					label: "其他"
				},
				{
					value: 11,
					label: "未填"
				}
			],
			sex: [{
					value: 1,
					label: "男"
				},
				{
					value: 2,
					label: "女"
				},
				{
					value: 3,
					label: "未知"
				}
			],
			//求职状态枚举值
			jobstatuslist: [{
					value: 1,
					label: "正在找工作"
				},
				{
					value: 2,
					label: "在职，正考虑换个新环境"
				},
				{
					value: 3,
					label: "在职，暂无跳槽打算"
				},
				{
					value: 4,
					label: "在职，有更好的机会也可以考虑"
				},
				{
					value: 5,
					label: "我要招聘"
				},
				{
					value: 6,
					label: "已入职试用"
				}
			],
			loading: false,
			memberList: [],
			total: 0,
			dialogVisible: false,
			userid: "",
			nickName: "",
			warnDialogVisible: false,
			warnForm: {
				userid: "",
				remindcontent: ""
			},
			blacklistDialogVisible: false,
			blacklistForm: {
				userid: "",
				isblacklist: "",
				blackreason: ""
			},
			reportDialogVisible: false,
			reportForm: {
				id: "",
				reporttype: "",
				content: ""
			},
			detailImg:'',
			detailShow:false,
			msgpush: {
				topShow: true,
				otherTables: true,
				selfTables: false,
				newmsgDialog: false,
				payrollTables: false,
				msgPic:[],
				tableTitle: [{
						title: "shortcon",
						mean: '消息内容'
					},
					{
						title: "userName",
						mean: '操作人员账户'
					},
					{
						title: "beingPstatus",
						mean: '推送用户类别'
					},
					{
						title: "createTime",
						mean: '推送日期'
					}
				],
				tablelist: [
					/* {
            content: 'adsdfsdfsdfsdfs',
            userName: '王小虎',
            createTime: '2016-05-04 12:01:01',
			shortcon:'asdsa'
          }, {
            content: '放假了放假了放假了放假了放假了放假了',
            userName: '王小虎',
            createTime: '2016-05-04 12:01:01',
			shortcon:'asds'
          } */
				],
				textarea: '',
				shortmsg: '',
				detailsDialog: false,
				cacheInfo: ''
			},

			fileList:[],
			/* 工资单搜索数据*/
			searchMsg: {
				noCardnum: true,
				noFounder: true,
				noTemplateName: true,
				searchData: {}, //搜索条件
			},
			/* 工资单数据列表*/
			payrollTableData: {
				list: [{
						title: '模板名称',
						prop: 'templateName',
						isClick: false
					},
					{
						title: '公司名称',
						prop: 'companyName',
						isClick: false
					},
					{
						title: '工资单月份',
						prop: 'distributedDate',
						isClick: false
					},
					{
						title: '录入人员',
						prop: 'enteringName',
						isClick: false
					},
					{
						title: '录入时间',
						prop: 'insertdate',
						isClick: false
					},
				],
			
				noOperation: true,
				operation: [{
						name: '查看明细',
						isBtn: false,
						title: 'openPayrollDetail'
					},
					{
						name: '开放展示',
						isBtn: false,
						title: 'opendisplay',
					},
					{
						name: '删除',
						isBtn: false,
						title: 'deletedTemplate'
					}
				],
				data: []
			},
			disAcitve:false,
			countPeopleBy7:0,
			countPeopleBy30:0,
			/* 工资单列表详情弹窗数据*/
			payrollDetailMsg: {
				showDialog: false,
				itemData: {},
				tableData: { //列表数据
					list: [],
					noOperation: false,
					operation: [],
					data: [],
					totalnum: 0
				},
			},
			/* 工资单导入详情弹窗*/
			payrollImportMsg: {
				showDialog: false,

			}
		};
	},
	watch: {
		'msgpush.newmsgDialog'() {
			if (this.msgpush.newmsgDialog == false) {
				this.msgpush.textarea = '';
			}
		}
	},
	mounted() {
		this.initActive()
		let index = this.GLOBAL.permisstions.findIndex(item => item.power === "3");
		this.options = this.GLOBAL.permisstions[index].tablelist;

		this.options.forEach(el => {
			if (el.table == '3001') {
				this.$set(el, "val", "0");
			} else if (el.table == '3002') {
				this.$set(el, "val", "1");
			} else if (el.table == '3003') {
				this.$set(el, "val", "2");
				el.tablename = '消息推送';
			} else if (el.table == '3004') {
				this.$set(el, "val", "3");
				el.tablename = '收入管理';
			}
		})
		if (this.options[0].table == "3001") {
			this.msgpush.selfTables = false;
			this.msgpush.topShow = true;
			this.msgpush.otherTables = true;
			this.msgpush.payrollTables = false;
			this.getAuthority();
			this.getTableDatas();
			this.reset();
		} else if (this.options[0].table == "3002") {
			this.msgpush.selfTables = false;
			this.msgpush.topShow = true;
			this.msgpush.otherTables = true;
			this.msgpush.payrollTables = false;
			this.getAuthority();
			this.getTableDatas();
			this.reset();
		} else if (this.options[0].table == "3003") {
			this.msgpush.topShow = false;
			this.msgpush.otherTables = false;
			this.msgpush.selfTables = true;
			this.msgpush.payrollTables = false;
			this.getNewmsg();
		} else if (this.options[0].table == "3004") {
			this.msgpush.selfTables = false;
			this.msgpush.topShow = false;
			this.msgpush.otherTables = false;
			this.msgpush.payrollTables = true;
			this.getPayrollList();
		}
		console.log(this.options);
		this.form.type = this.options[0].val;
		this.title = this.options[0].tablename;
		/* let currentType = this.options.findIndex(item => item.table == "3001");
		if (currentType == "-1") {
			this.form.type = "1";
			this.title = "黑名单";
		} */
		this.btnAuthority = this.GLOBAL.powerAllBtn.hygl;
		this.getFunctionList();
	},
	methods: {
		lookDetail(data){
			this.detailShow = true
			this.detailImg = data
		},
		handleRemove(file) {
			console.log(file);
		 let url = 	file.response.data
			this.fileList = this.fileList.filter(obj => obj !== url);
			console.log(this.fileList);
			this.disAcitve =false
		  },
		uploadSuccess(res) {
			console.log(res);
			this.fileList.push(res.data);
			 this.loading.close()
			 console.log(this.loading);
			if (this.fileList.length ==4) {
				this.disAcitve =true
				this.$message.error('最多上传四张！')
			}
		},
		uploadbefor(file){
         
			console.log(file);
			const testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
			const extension = testmsg === "jpg";//限制只能上传jpg文件，否则阻止上传
			if (!extension ) {
			  this.$message({
				message: "上传文件只能是.jpg格式!",
				type: "warning",
			  });
			  return Promise.reject();
			}
			 
		  const isLt3M = file.size / 1024 / 1024 < 4;
			console.log( file.size);
		 
	
		  if (!isLt3M) {
			this.$message.error('图片大小不能超过3MB');
			return Promise.reject();
		   
		  }


			 this.loading = this.$loading({
			  lock: true,
			  text: '图片正在上传。。。',
			  spinner: 'el-icon-loading',
			  background: 'rgba(0, 0, 0, 0.7)'
			});
			return Promise.resolve();
		  },
		initActive(){
			this.getActivePeople(1)
			this.getActivePeople(2)
			this.getActivePeople(3)
			this.getActivePeople(4)
			this.getActivePeople(5)
		},
		
		//获取活跃的用户人数
		getActivePeople(data){
			
			this.$ceshiAxios.get('v1/message/ActivityUseridByType?type='+data).then(res=>{
			
			if(data==1){
				  this.countPeopleBy7 = '7天内活跃用户('+res.data.data+'人)'
			}else if(data==2){
				  this.countPeopleBy30 = '30天内不活跃用户('+res.data.data+'人)'
			}else if(data==3){
				this.countPeopleByAll = '所有用户('+res.data.data+'人)'
				this.statusname=this.countPeopleByAll
			}else if(data==4){
				this.countPeopleByHr = '所有HR('+res.data.data+'人)'
			}else if(data==5){
				this.countPeopleByJobseeker = '所有求职者('+res.data.data+'人)'
			}
				
			})
			
		},
		//消息推送app
		messendByapp(){
		this.msgpush.newmsgDialog = true
		this.pushtitle='新消息推送'
		},
		messendBymsg(){
		this.msgpush.newmsgDialog = true
		this.pushtitle='短信推送'
		
		},
		
		
		tabSwitch(index) {
			this.navList.index = index;
			console.log(this.navList.index );
			this.getNewmsg()
			},
		getvalue() {
			if (this.statusname.substr(0,4) == '所有用户') {
				this.status = 1
				console.log(this.status);
			} else if (this.statusname.substr(0,4) == '所有HR') {
				this.status = 2
				console.log(this.status);
			} else if (this.statusname.substr(0,5) == '所有求职者') {
				this.status = 3
			}else if(this.statusname.substr(0,3) =='7天内'){
				this.status = 4
			}else if(this.statusname.substr(0,4) =='30天内'){
					this.status = 5
			}
			console.log(this.statusname);
				console.log(this.status);
		},
		/* 获取工资单列表 */
		getPayrollList(form) {
			let params = {
				pageNum: this.form.pagenum,
				pageSize: this.form.pagesize,
			}
			if (form) {
				Object.assign(params, form);
			}
			this.$payrollAxios.post('/v1/PayRoll/selectPayrollDetailsList', params).then(res => {
				console.log(res);
				if (res.data.code === 1) {
					this.payrollTableData.data = [];
					let result = res.data.data;
					this.payrollTableData.data = result.appPayrollDetails;
					this.total = parseInt(result.totalnum);
				} else {
					this.$message.warning(res.data.message);
				}
			})
		},
		/* 工资单页面-查询功能 */
		search(form) {
			console.log(form);
			this.searchMsg.searchData = form;
			this.getPayrollList(form);
			this.searchData_copy = form;
		},
		opendisplay(data) {
			this.centerDialogVisible = true;
			this.tableData = data;
		},
		opendisplay_go() {
			this.$payrollAxios.post('/v1/PayRoll/updatejudge', {
				detailsid: this.tableData.templateid,
				judge: 1
			}).then(res => {
				console.log(res)
				if (res.data.code == 1) {
					this.$message('开放展示成功');
					this.getPayrollList();
					this.centerDialogVisible = false;
				}
			}).catch(err => {})
		},
		/* 打开工资单列表详情弹窗 */
		openPayrollDetail(data) {
			console.log(this.$store.state.form);
			console.log(data);
			data.createusername = this.$store.state.form.createusername;
			data.identity = this.$store.state.form.identity;
			this.payrollDetailMsg.itemData = data;
			this.getPayrollDetail(data);
		},
		/* 工资单获取详情数据 */
		getPayrollDetail(data) {
			console.log(data)
			this.$payrollAxios.post('/v1/PayRoll/selectPayrollDetails', data).then(res => {
				console.log(res);
				if (res.data.code === 1) {
					let result = res.data.data;
					this.payrollDetailMsg.tableData.list = [];
					this.payrollDetailMsg.tableData.data = [];
					result.payrollNameDetails.forEach((item, index) => {
						if (item == '姓名') {
							this.payrollDetailMsg.tableData.list.push({
								title: '姓名',
								prop: 'staffName',
								isClick: false
							});
						} else if (item == '身份证号码') {
							this.payrollDetailMsg.tableData.list.push({
								title: '身份证号码',
								prop: 'staffIdCard',
								isClick: false
							});
						} else if (item == '账户收入') {
							this.payrollDetailMsg.tableData.list.push({
								title: '账户收入',
								prop: 'takeHomePay',
								isClick: false
							});
						} else {
							this.payrollDetailMsg.tableData.list.push({
								title: item,
								prop: 'prop' + (index - 3),
								isClick: false
							});
						}
					})

					result.payrollToLeadDetailRequests.forEach((item, index) => {
						let nav = {
							staffName: item.staffName,
							staffIdCard: item.staffIdCard,
							takeHomePay: item.takeHomePay,
						};
						item.payrollDetailsItem.forEach((sub, key) => {
							nav['prop' + key] = sub;
						})
						this.payrollDetailMsg.tableData.data.push(nav);
					})

					this.payrollDetailMsg.totalnum = result.totalnum;
					this.payrollDetailMsg.showDialog = true;
				} else {
					this.$message.warning(res.data.message);
				}
			})
		},
		/* 工资单详情弹窗中的分页 */
		changePageNum(data) {
			this.payrollDetailMsg.itemData.pageNum = data;
			this.getPayrollDetail(this.payrollDetailMsg.itemData);
		},
		/* 工资单详情弹窗中的分页 */
		changePageSize(data) {
			this.payrollDetailMsg.itemData.pageSize = data;
			this.getPayrollDetail(this.payrollDetailMsg.itemData);
		},
		/* 删除工资单列表中的数据 */
		deletedTemplate(data) {
			console.log(data);

			this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				this.$payrollAxios.post('/v1/PayRoll/deletedPayrollDetails', data).then(res => {
					console.log(res);
					if (res.data.code === 1) {
						this.getPayrollList(this.searchMsg.searchData);
						this.$message({
							type: 'success',
							message: '删除成功!'
						});
					} else {
						this.$message.warning(res.data.message);
					}
				})

			}).catch(() => {
				this.$message({
					type: 'info',
					message: '已取消删除'
				});
			});


		},
		// 获取地区权限
		getAuthority() {
			let userinfo = localStorage.getItem("userinfo");
			userinfo = JSON.parse(userinfo);
			this.level = userinfo.level;
			this.form.province = +userinfo.province || "";
			this.form.city = +userinfo.city || "";
			this.form.area = +userinfo.area || "";
			this.form.citys = [];
			this.form.citys.push(+userinfo.province);
			this.form.citys.push(+userinfo.city);
			this.form.citys.push(+userinfo.area);
		},
		// 切换tab栏
		handleClick(item) {
			console.log(item);
			this.form.type = item.val;
			this.form.pagenum = 1;
			if (item.val == "2") {
				this.msgpush.topShow = false;
				this.msgpush.otherTables = false;
				this.msgpush.selfTables = true;
				this.msgpush.payrollTables = false;
				this.getNewmsg();
			} else if (item.val == "1" || item.val == "0") {
				this.msgpush.selfTables = false;
				this.msgpush.topShow = true;
				this.msgpush.otherTables = true;
				this.msgpush.payrollTables = false;

				this.title = item.val === "0" ? "会员列表" : "黑名单";
				this.getAuthority();
				this.getTableDatas();
				this.reset();
			} else if (item.val == "3") {
				this.msgpush.selfTables = false;
				this.msgpush.topShow = false;
				this.msgpush.otherTables = false;
				this.msgpush.payrollTables = true;
				this.getPayrollList();

			}
		},
		// 新的获取职能数据
		getFunctionList() {
			this.$http.get('../../assets/select_function.json').then(res => {
				this.functionOption = res.body.position;
				console.log(this.functionOption)
			})
		},
		/* 职能 */
		functionChange(value) {
			console.log(value);
			if (value.length == 0) {
				this.form.tradeid = '';
			} else {
				this.form.tradeid = value[2].toString();
			}
		},
		// 选择城市
		handleCityChange(val) {
			this.form.citys = val;
			this.form.province = val[0];
			this.form.city = val[1];
			this.form.area = val[2];
		},
		handleChangeInput(val) {
			var reg = /^[+]{0,1}(\d+)$/;
			if (!reg.test(val)) {
				this.$message({
					message: "请输入正确的年龄",
					type: "warning"
				});
				this.form.minage = "";
			}
		},
		handleChangeInput2(val) {
			var reg = /^[+]{0,1}(\d+)$/;
			if (!reg.test(val)) {
				this.$message({
					message: "请输入正确的年龄",
					type: "warning"
				});
				this.form.maxage = "";
			}
		},
		// 重置
		reset() {
			console.log(this.$refs);
			this.$refs["memberForm"].resetFields();
			this.form.minage = "";
			this.form.maxage = "";
			this.getAuthority();
		},
		// 获取表格数据
		getTableDatas() {
			if (
				this.form.minage &&
				this.form.maxage &&
				+this.form.minage > +this.form.maxage
			) {
				this.$message({
					message: "最大年龄不能小于最小年龄",
					type: "error"
				});
				return;
			}
			this.loading = true;
			console.log(this.form);
			this.$axios.post("/app/v1/platform/member/list", this.form).then(resp => {
				this.loading = false;
				console.log(resp);
				if (resp.data.code === 1) {
					this.memberList = resp.data.data.list;
					this.total = parseInt(resp.data.data.totalnum);
				} else {
					this.$message({
						message: resp.data.message,
						type: "error"
					});
				}
			});
		},
		// 查询
		query() {
			this.form.pagenum = 1;
			this.getTableDatas();
		},
		// 分页
		handleCurrentChange(val) {
			this.form.pagenum = val;
			if (this.form.type == 2) {
				this.getNewmsg();
			} else if (this.form.type == 0 || this.form.type == 1) {
				this.getTableDatas();
			} else if (this.form.type == 3) {
				this.getPayrollList(this.searchMsg.searchData);
			}
		},
		handleSizeChange(val) {
			this.form.pagenum = 1;
			this.form.pagesize = val;
			if (this.form.type == 2) {
				this.getNewmsg();
			} else if (this.form.type == 0 || this.form.type == 1) {
				this.getTableDatas();
			} else if (this.form.type == 3) {
				this.getPayrollList(this.searchMsg.searchData);
			}
		},
		// 查看会员详情
		handleClickNickName(row) {
			console.log(row)
			this.userid = row.userid;
			this.nickName = row.nickname;
			this.dialogVisible = true;
		},
		// 提醒
		handleClickWarn(row) {
			this.warnForm.userid = row.userid;
			this.warnDialogVisible = true;
		},
		cancleWarn() {
			this.warnForm.userid = "";
			this.warnForm.remindcontent = "";
			this.warnDialogVisible = false;
		},
		closeWarnDialog() {
			this.warnForm.userid = "";
			this.warnForm.remindcontent = "";
		},
		warn() {
			if (!this.warnForm.remindcontent) {
				this.$message({
					message: "请输入提醒内容",
					type: "warning"
				});
				return;
			} else {
				this.$axios
					.post("/app/v1/platform/member/remind", this.warnForm)
					.then(res => {
						if (res.data.code === 1) {
							this.$message({
								message: "操作成功",
								type: "success"
							});
						} else {
							this.$message({
								message: res.data.message,
								type: "error"
							});
						}
						this.warnDialogVisible = false;
					});
			}
		},
		// 拉黑
		handleClickBlacklist(row) {
			this.blacklistForm.userid = row.userid;
			this.blacklistDialogVisible = true;
		},
		closeblacklistDialog() {
			this.blacklistForm.userid = "";
			this.blacklistForm.isblacklist = "";
			this.blacklistForm.blackreason = "";
		},
		blacklist(val) {
			if (!this.blacklistForm.blackreason) {
				this.$message({
					message: "请输入拉黑原因",
					type: "warning"
				});
				return;
			} else {
				this.blacklistForm.isblacklist = val;
				this.$axios
					.post("/app/v1/platform/member/joinblacklist", this.blacklistForm)
					.then(res => {
						if (res.data.code === 1) {
							this.$message({
								message: "操作成功",
								type: "success"
							});
						} else {
							this.$message({
								message: res.data.message,
								type: "error"
							});
						}
						this.blacklistDialogVisible = false;
						this.getTableDatas();
					});
			}
		},
		// 拉黑上报
		handleClickReport1(row) {
			this.reportForm.id = row.userid;
			this.reportForm.reporttype = "5";
			this.reportDialogVisible = true;
		},
		// 还原上报
		handleClickReport2(row) {
			this.reportForm.id = row.userid;
			this.reportForm.reporttype = "6";
			this.reportDialogVisible = true;
		},
		closeReportDialog() {
			this.reportForm.id = "";
			this.reportForm.reporttype = "";
			this.reportForm.content = "";
		},
		report() {
			if (!this.reportForm.content) {
				this.$message({
					message: "上报内容不能为空！",
					type: "warning"
				});
				return;
			}
			this.$axios
				.post("/app/v1/platform/unusual/reportSubmit", this.reportForm)
				.then(res => {
					if (res.data.code === 1) {
						this.$message({
							message: "操作成功",
							type: "success"
						});
					} else {
						this.$message({
							message: res.data.message,
							type: "error"
						});
					}
					this.reportDialogVisible = false;
				});
		},
		// 还原
		handleClickRecover(row) {
			this.$confirm("此操作将还原该用户, 是否继续?", "提示", {
					confirmButtonText: "确定",
					cancelButtonText: "取消",
					type: "warning"
				})
				.then(() => {
					this.blacklistForm.userid = row.userid;
					this.blacklistForm.isblacklist = "0";
					this.$axios
						.post("/app/v1/platform/member/joinblacklist", this.blacklistForm)
						.then(res => {
							if (res.data.code === 1) {
								this.$message({
									message: "操作成功",
									type: "success"
								});
							} else {
								this.$message({
									message: res.data.message,
									type: "error"
								});
							}
							this.blacklistDialogVisible = false;
							this.getTableDatas();
						});
				})
				.catch(() => {
					console.log("取消操作");
				});
		},
		// 导出https://house.fcw-china.com/app
		exportData() {
			console.log(this.form);
			this.$axios({
					method: "post",
					url: "app/v1/platform/statistic/registerMemberListOut",
					data: this.form,
					responseType: "blob"
				})
				.then(res => {
					console.log(res)
					this.download(res);
				})
				.catch(error => {
					console.log(error);
					this.$message({
						message: "导出失败,请重新操作",
						type: "warning"
					});
				});
		},
		download(res) {
			if (!res) {
				return;
			}
			let bob = new Blob([res.data]);
			console.log(res);
			let fileName = res.headers["content-disposition"].split("=")[1];
			console.log(fileName);
			fileName = decodeURI(fileName);
			let url = window.URL.createObjectURL(bob);
			let link = document.createElement("a");
			link.style.display = "none";
			link.href = url;
			link.setAttribute("download", fileName);
			document.body.appendChild(link);
			link.click();
			this.$message({
				message: "导出成功",
				type: "success"
			});
		},
		// 获取消息推送的列表消息
		getNewmsg() {
			// let pushType = 1
			// if(this.pushtitle=='短信推送'){
			// 	pushType = 2
			// }
			let params = {
				pagenum: this.form.pagenum,
				pagesize: this.form.pagesize,
				pushType:this.navList.index+1,
			}
			this.$ceshiAxios
				.post("/v1/pushList/selectPushList", params)
				.then(res => {
					console.log(res);
					if (res.data.code === 1) {
						this.total = parseInt(res.data.data.totalnum);
						let result = res.data.data.list;
						for (let i = 0; i < result.length; i++) {
							result[i].createTime = result[i].createTime.substring(0, result[i].createTime.length -
								2);
							if(result[i].content!=undefined){
							if (result[i].content.length > 20) {
								result[i].shortcon = result[i].content.substring(0, 20) + '...';
							} else {
								result[i].shortcon = result[i].content;
							}
							}
							if (result[i].beingPstatus == '1') {
								console.log(this.status);
								result[i].beingPstatus = "所有用户"
							} else if (result[i].beingPstatus == '2') {
								result[i].beingPstatus = '所有hr'
							} else if (result[i].beingPstatus == '3') {
								result[i].beingPstatus = '所有求职者'
							}else if (result[i].beingPstatus == '4') {
								result[i].beingPstatus = '7天活跃用户'
							}else if (result[i].beingPstatus == '5') {
								result[i].beingPstatus = '30天不活跃用户'
							}
						}
						this.msgpush.tablelist = result;
					} else {
						this.$message({
							message: res.data.message,
							type: "error"
						});
					}

				});
		},
		// 新增消息
		sendNews() {
			let pictures = ''
			pictures = JSON.stringify(this.fileList)
			// 请求接口发送数据
			let data = JSON.parse(localStorage.getItem('userinfo'));
			let form = {
				position: data.position,
				telnum: data.telnum,
				userName: data.username,
				content: this.msgpush.textarea,
				status: this.status,
				pictures:pictures
			}
			
			if(form.content==''){
				return this.$message.warning('请输入推送内容')
				
			}
			let url;
			if(this.pushtitle=='新消息推送'){
				url = "/v1/message/allPushContext"
			}else if(this.pushtitle=='短信推送') {
				url="/v1/platform/member/ztMsmPush"
			}
			this.btndisabled = true
			console.log(form);
			this.$ceshiAxios
				.post(url, form)
				.then(res => {
					console.log(res);
					if (res.data.code === 1) {
						this.$message({
							message: "操作成功",
							type: "success"
						});
					} else {
						this.$message({
							message: res.data.message,
							type: "error"
						});
					}
				});
				this.fileList = []
			this.msgpush.textarea = '';
			this.msgpush.newmsgDialog = false;
			this.btndisabled = false
			setTimeout(() => {
				this.getNewmsg();				
			}, 500);
		},
		// 查看详细的新增消息内容
		detailsMsg(data) {
			this.msgpush.detailsDialog = true;
			this.msgpush.shortmsg = data.content;
			 
			if(data.pictures.indexOf('https')!=-1){
				this.msgpush.msgPic = JSON.parse(data.pictures)
			}else {
				this.msgpush.msgPic = []
			}
			
		}
	}
};
